<!DOCTYPE html>
<html lang="zh" style="min-height: 22px;">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

    <title></title>

    <meta name="author" content="Summer">

    <!-- Styles -->
    <link href="https://iocaffcdn.phphub.org//build/css/0581d3cf5f6c7a36bc65-vendors.css" rel="stylesheet">
    <link href="https://iocaffcdn.phphub.org//build/css/b60fdc4fda399d72091d-app.css" rel="stylesheet">

    <style> .ui.visible.left.sidebar ~ .fixed, .ui.visible.left.sidebar ~ .pusher {
        -webkit-transform: translate3d(200px, 0, 0);
        transform: translate3d(200px, 0, 0);
    }</style>
</head>
<body class="books-articles-show-page pushable">

<!-- Scripts -->
<script>
    window.Laravel = {"csrfToken": ""}    </script>

<script>
    window.Config = {
        'GA_Tracking_ID': '',
        'user_id': 0,
        'search_user_id': 0,
        'cdn_domain': 'iocaffcdn.phphub.org',
        'domain': 'learnku.com',
        'request_interval': 600000, // 消息通知检测周期
        'notification_count': 0,
        'token': '',
        'environment': 'production',
        'url': 'https://learnku.com',
        'tags_url': '',
        'community': {
            'id': 1,
            'name': 'Laravel'
        },
        'routes': {
            'notificationsCount': 'https://learnku.com/notifications/count',
            'upload_image': 'https://learnku.com/courses/upload_image',
            'api_search': 'https://learnku.com/books/api_search/41',
            'collections_store': 'https://learnku.com/collections',
            'collections_my': 'https://learnku.com/collections/my/ajax',
        },
        'cdnDomain': 'https://iocaffcdn.phphub.org/',
        'following_users': [],
        'search_type': 'standard',
        'book_id': 41,
        'is_docs': "no",
        'article_id': 1596,
        'topic_id': 0,
        'user_settings': {
            'visit_topic_patches_page': false,
            'select_best_answer_guide': false
        }
    };

    var ShowCrxHint = 'no';
</script>

<style>

    .ui.top.menu {
        border-top: 4px solid #f46660;
    }

    .ui.fluid.search .results {
        width: 550px;
    }

    @media only screen and (max-width: 767px) {
        .ui.top.menu > .ui.container {
            height: 52px;
            flex-direction: initial;
        }
    }

    /* 顶部导航栏 */
    .ui.top.menu {
        border-top: 4px solid #f4645f;
    }

    /* 右边导航栏顶部样式 */
    .ui.top-color.segment:not(.inverted) {
        border-top: 2px solid #f4645f;
    }

    /* 右边导航栏顶部样式 */
    .ui.top-color.card:not(.inverted) {
        border-top: 2px solid #f4645f;
    }

    /* 主要按钮 */

    .ui.primary.buttons .button, .ui.primary.button {
        background-color: #f4645f;
        border-color: #f4645f;
    }

    /* 主要按钮选中状态 */
    .ui.primary.buttons .button:hover, .ui.primary.button:hover {
        background-color: #f4645f;
        border-color: #f4645f;
    }

    /* 外框按钮 */
    .ui.basic.primary.buttons .button, .ui.basic.primary.button {
        color: #f4645f !important;
        box-shadow: 0px 0px 0px 1px #f4645f inset !important;
    }

    /* 外框按钮选中状态 */
    .ui.basic.primary.buttons .button:hover, .ui.basic.primary.button:hover {
        color: #f4645f !important;
        box-shadow: 0px 0px 0px 1px #f4645f inset !important;
    }

    .ui.basic.primary.buttons .button:active, .ui.basic.primary.button:active, .ui.basic.primary.buttons .active.button, .ui.basic.primary.active.button, .ui.basic.buttons .button:hover, .ui.basic.button:hover, .ui.basic.primary.buttons .button:focus, .ui.basic.primary.button:focus {
        color: #f4645f !important;
        box-shadow: 0px 0px 0px 1px #f4645f inset !important;
    }

</style>


<div class="pusher" style="width: 89.5833%; margin-left: 10.4167%;">

    <div class="main container">


        <script type="text/javascript">
            Config.search_type = 'category';
        </script>


        <div class="ui centered grid container stackable">

            <div class="wide column">


                <div class="ui segment article-content">


                    <div class="extra-padding">

                        <h1>
                            <i class="grey file text outline icon"></i>
                            <span style="line-height: 34px;">5.8. 收藏商品列表 </span>


                        </h1>

                        <p class="book-article-meta">

                            <a href="https://learnku.com/courses/laravel-shop/5.5"><i class="icon book"></i> L05 Laravel
                                教程 - 电商实战 ( Laravel 5.5 ) </a>


                        </p>


                        <div class="ui divider"></div>

                        <div class="ui readme markdown-body content-body fluidbox-content">


                            <div name="abb263" data-unique="abb263"></div>
                            <h2>收藏商品列表</h2>
                            <p>上一节我们实现了收藏商品的功能，接下来本章节要实现收藏商品的列表页面。</p>
                            <div name="20ac9a" data-unique="20ac9a"></div>
                            <h2>1. 控制器</h2>
                            <p>在 <code>ProductsController</code> 中添加一个 <code>favorites()</code> 方法：</p>
                            <p><em>app/Http/Controllers/ProductsController.php</em></p>
                            <pre class="  language-php"><code class="  language-php"><span
                                    class="token punctuation">.</span>
<span class="token punctuation">.</span>
<span class="token punctuation">.</span>
    <span class="token keyword">public</span> <span class="token keyword">function</span> <span class="token function">favorites</span><span
                                        class="token punctuation">(</span>Request <span
                                        class="token variable">$request</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token variable">$products</span> <span class="token operator">=</span> <span
                                        class="token variable">$request</span><span class="token operator">-</span><span
                                        class="token operator">&gt;</span><span class="token function">user</span><span
                                        class="token punctuation">(</span><span class="token punctuation">)</span><span
                                        class="token operator">-</span><span class="token operator">&gt;</span><span
                                        class="token function">favoriteProducts</span><span
                                        class="token punctuation">(</span><span class="token punctuation">)</span><span
                                        class="token operator">-</span><span class="token operator">&gt;</span><span
                                        class="token function">paginate</span><span
                                        class="token punctuation">(</span><span class="token number">16</span><span
                                        class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token keyword">return</span> <span class="token function">view</span><span
                                        class="token punctuation">(</span><span
                                        class="token single-quoted-string string">'products.favorites'</span><span
                                        class="token punctuation">,</span> <span class="token punctuation">[</span><span
                                        class="token single-quoted-string string">'products'</span> <span
                                        class="token operator">=</span><span class="token operator">&gt;</span> <span
                                        class="token variable">$products</span><span
                                        class="token punctuation">]</span><span class="token punctuation">)</span><span
                                        class="token punctuation">;</span>
    <span class="token punctuation">}</span></code></pre>
                            <p>这里我们用分页的方式取出当前用户的收藏商品，由于我们在定义关联关系的时候就已经加上了排序规则，这里就不需要再次设置了。</p>
                            <div name="58a6bc" data-unique="58a6bc"></div>
                            <h2>2. 前端模板</h2>
                            <p>创建一个新的模板文件：</p>
                            <pre class="  language-php"><code class="  language-php">$ touch resources<span
                                    class="token operator">/</span>views<span
                                    class="token operator">/</span>products<span class="token operator">/</span>favorites<span
                                    class="token punctuation">.</span>blade<span
                                    class="token punctuation">.</span>php</code></pre>
                            <p><em>resources/views/products/favorites.blade.php</em></p>
                            <pre class="  language-php"><code class="  language-php">@<span class="token keyword">extends</span><span
                                    class="token punctuation">(</span><span class="token single-quoted-string string">'layouts.app'</span><span
                                    class="token punctuation">)</span>
@<span class="token function">section</span><span class="token punctuation">(</span><span
                                        class="token single-quoted-string string">'title'</span><span
                                        class="token punctuation">,</span> <span
                                        class="token single-quoted-string string">'我的收藏'</span><span
                                        class="token punctuation">)</span>

@<span class="token function">section</span><span class="token punctuation">(</span><span
                                        class="token single-quoted-string string">'content'</span><span
                                        class="token punctuation">)</span>
<span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"row"</span><span
                                        class="token operator">&gt;</span>
<span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"col-lg-10 col-lg-offset-1"</span><span
                                        class="token operator">&gt;</span>
<span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"panel panel-default"</span><span
                                        class="token operator">&gt;</span>
  <span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"panel-heading"</span><span
                                        class="token operator">&gt;</span>我的收藏<span
                                        class="token operator">&lt;</span><span class="token operator">/</span>div<span
                                        class="token operator">&gt;</span>
  <span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"panel-body"</span><span
                                        class="token operator">&gt;</span>
    <span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"row products-list"</span><span
                                        class="token operator">&gt;</span>
      @<span class="token keyword">foreach</span><span class="token punctuation">(</span><span class="token variable">$products</span> <span
                                        class="token keyword">as</span> <span
                                        class="token variable">$product</span><span class="token punctuation">)</span>
        <span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"col-xs-3 product-item"</span><span
                                        class="token operator">&gt;</span>
          <span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"product-content"</span><span
                                        class="token operator">&gt;</span>
            <span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"top"</span><span
                                        class="token operator">&gt;</span>
              <span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"img"</span><span
                                        class="token operator">&gt;</span>
                <span class="token operator">&lt;</span>a href<span class="token operator">=</span><span
                                        class="token double-quoted-string string">"{{ route('products.show', ['product' =&gt; <span
                                        class="token interpolation"><span class="token variable">$product</span><span
                                        class="token operator">-</span><span class="token operator">&gt;</span><span
                                        class="token property">id</span></span>]) }}"</span><span
                                        class="token operator">&gt;</span>
                  <span class="token operator">&lt;</span>img src<span class="token operator">=</span><span
                                        class="token double-quoted-string string">"{{ <span class="token interpolation"><span
                                        class="token variable">$product</span><span class="token operator">-</span><span
                                        class="token operator">&gt;</span><span class="token property">image_url</span></span> }}"</span> alt<span
                                        class="token operator">=</span><span class="token double-quoted-string string">""</span><span
                                        class="token operator">&gt;</span>
                <span class="token operator">&lt;</span><span class="token operator">/</span>a<span
                                        class="token operator">&gt;</span>
              <span class="token operator">&lt;</span><span class="token operator">/</span>div<span
                                        class="token operator">&gt;</span>
              <span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"price"</span><span
                                        class="token operator">&gt;</span><span class="token operator">&lt;</span>b<span
                                        class="token operator">&gt;</span>￥<span class="token operator">&lt;</span><span
                                        class="token operator">/</span>b<span class="token operator">&gt;</span><span
                                        class="token punctuation">{</span><span class="token punctuation">{</span> <span
                                        class="token variable">$product</span><span class="token operator">-</span><span
                                        class="token operator">&gt;</span><span
                                        class="token property">price</span> <span
                                        class="token punctuation">}</span><span class="token punctuation">}</span><span
                                        class="token operator">&lt;</span><span class="token operator">/</span>div<span
                                        class="token operator">&gt;</span>
              <span class="token operator">&lt;</span>a href<span class="token operator">=</span><span
                                        class="token double-quoted-string string">"{{ route('products.show', ['product' =&gt; <span
                                        class="token interpolation"><span class="token variable">$product</span><span
                                        class="token operator">-</span><span class="token operator">&gt;</span><span
                                        class="token property">id</span></span>]) }}"</span><span
                                        class="token operator">&gt;</span><span class="token punctuation">{</span><span
                                        class="token punctuation">{</span> <span
                                        class="token variable">$product</span><span class="token operator">-</span><span
                                        class="token operator">&gt;</span><span
                                        class="token property">title</span> <span
                                        class="token punctuation">}</span><span class="token punctuation">}</span><span
                                        class="token operator">&lt;</span><span class="token operator">/</span>a<span
                                        class="token operator">&gt;</span>
            <span class="token operator">&lt;</span><span class="token operator">/</span>div<span
                                        class="token operator">&gt;</span>
            <span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"bottom"</span><span
                                        class="token operator">&gt;</span>
              <span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"sold_count"</span><span
                                        class="token operator">&gt;</span>销量 <span class="token operator">&lt;</span>span<span
                                        class="token operator">&gt;</span><span class="token punctuation">{</span><span
                                        class="token punctuation">{</span> <span
                                        class="token variable">$product</span><span class="token operator">-</span><span
                                        class="token operator">&gt;</span><span class="token property">sold_count</span> <span
                                        class="token punctuation">}</span><span class="token punctuation">}</span>笔<span
                                        class="token operator">&lt;</span><span class="token operator">/</span>span<span
                                        class="token operator">&gt;</span><span class="token operator">&lt;</span><span
                                        class="token operator">/</span>div<span class="token operator">&gt;</span>
              <span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"review_count"</span><span
                                        class="token operator">&gt;</span>评价 <span class="token operator">&lt;</span>span<span
                                        class="token operator">&gt;</span><span class="token punctuation">{</span><span
                                        class="token punctuation">{</span> <span
                                        class="token variable">$product</span><span class="token operator">-</span><span
                                        class="token operator">&gt;</span><span
                                        class="token property">review_count</span> <span
                                        class="token punctuation">}</span><span class="token punctuation">}</span><span
                                        class="token operator">&lt;</span><span class="token operator">/</span>span<span
                                        class="token operator">&gt;</span><span class="token operator">&lt;</span><span
                                        class="token operator">/</span>div<span class="token operator">&gt;</span>
            <span class="token operator">&lt;</span><span class="token operator">/</span>div<span
                                        class="token operator">&gt;</span>
          <span class="token operator">&lt;</span><span class="token operator">/</span>div<span class="token operator">&gt;</span>
        <span class="token operator">&lt;</span><span class="token operator">/</span>div<span class="token operator">&gt;</span>
      @<span class="token keyword">endforeach</span>
    <span class="token operator">&lt;</span><span class="token operator">/</span>div<span
                                        class="token operator">&gt;</span>
    <span class="token operator">&lt;</span>div <span class="token keyword">class</span><span
                                        class="token operator">=</span><span class="token double-quoted-string string">"pull-right"</span><span
                                        class="token operator">&gt;</span><span class="token punctuation">{</span><span
                                        class="token punctuation">{</span> <span class="token variable">$products</span><span
                                        class="token operator">-</span><span class="token operator">&gt;</span><span
                                        class="token function">render</span><span
                                        class="token punctuation">(</span><span class="token punctuation">)</span> <span
                                        class="token punctuation">}</span><span class="token punctuation">}</span><span
                                        class="token operator">&lt;</span><span class="token operator">/</span>div<span
                                        class="token operator">&gt;</span>
  <span class="token operator">&lt;</span><span class="token operator">/</span>div<span
                                        class="token operator">&gt;</span>
<span class="token operator">&lt;</span><span class="token operator">/</span>div<span class="token operator">&gt;</span>
<span class="token operator">&lt;</span><span class="token operator">/</span>div<span class="token operator">&gt;</span>
<span class="token operator">&lt;</span><span class="token operator">/</span>div<span class="token operator">&gt;</span>
@endsection</code></pre>
                            <p>代码基本上与商品列表页一致。</p>
                            <div name="85aed1" data-unique="85aed1"></div>
                            <h2>3. 路由</h2>
                            <p>接下来添加路由：</p>
                            <p><em>routes/web.php</em></p>
                            <pre class="  language-php"><code class="  language-php"><span
                                    class="token punctuation">.</span>
<span class="token punctuation">.</span>
<span class="token punctuation">.</span>
<span class="token scope">Route<span class="token punctuation">::</span></span><span class="token function">group</span><span
                                        class="token punctuation">(</span><span class="token punctuation">[</span><span
                                        class="token single-quoted-string string">'middleware'</span> <span
                                        class="token operator">=</span><span class="token operator">&gt;</span> <span
                                        class="token single-quoted-string string">'auth'</span><span
                                        class="token punctuation">]</span><span class="token punctuation">,</span> <span
                                        class="token keyword">function</span><span
                                        class="token punctuation">(</span><span class="token punctuation">)</span> <span
                                        class="token punctuation">{</span>
    <span class="token punctuation">.</span>
    <span class="token punctuation">.</span>
    <span class="token punctuation">.</span>
    <span class="token scope">Route<span class="token punctuation">::</span></span><span
                                        class="token function">group</span><span class="token punctuation">(</span><span
                                        class="token punctuation">[</span><span
                                        class="token single-quoted-string string">'middleware'</span> <span
                                        class="token operator">=</span><span class="token operator">&gt;</span> <span
                                        class="token single-quoted-string string">'email_verified'</span><span
                                        class="token punctuation">]</span><span class="token punctuation">,</span> <span
                                        class="token keyword">function</span><span
                                        class="token punctuation">(</span><span class="token punctuation">)</span> <span
                                        class="token punctuation">{</span>
        <span class="token punctuation">.</span>
        <span class="token punctuation">.</span>
        <span class="token punctuation">.</span>
        <span class="token scope">Route<span class="token punctuation">::</span></span><span
                                        class="token function">get</span><span class="token punctuation">(</span><span
                                        class="token single-quoted-string string">'products/favorites'</span><span
                                        class="token punctuation">,</span> <span
                                        class="token single-quoted-string string">'ProductsController@favorites'</span><span
                                        class="token punctuation">)</span><span class="token operator">-</span><span
                                        class="token operator">&gt;</span><span class="token function">name</span><span
                                        class="token punctuation">(</span><span
                                        class="token single-quoted-string string">'products.favorites'</span><span
                                        class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span><span
                                        class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
                            <p>现在测试一下：访问 <a href="http://shop.test/products/favorites">http://shop.test/products/favorites</a>
                            </p>
                            <p>
                                <a href="https://iocaffcdn.phphub.org/uploads/images/201805/21/5320/MuqZvnyL18.png?imageView2/2/w/1240/h/0"
                                   class="fluidbox fluidbox__instance-1 fluidbox--initialized fluidbox--ready fluidbox--closed">
                                    <div class="fluidbox__wrap" style="z-index: 990;"><img
                                            src="https://iocaffcdn.phphub.org/uploads/images/201805/21/5320/MuqZvnyL18.png?imageView2/2/w/1240/h/0"
                                            alt="file" class="fluidbox__thumb" style="opacity: 1;">
                                        <div class="fluidbox__ghost"
                                             style="width: 1100px; height: 698px; top: 11px; left: 1px; background-image: url(&quot;https://iocaffcdn.phphub.org/uploads/images/201805/21/5320/MuqZvnyL18.png?imageView2/2/w/1240/h/0&quot;); opacity: 0; transform: translate(0px, 0px) scale(1, 1);"></div>
                                    </div>
                                </a></p>
                            <p>明明已经添加好路由却提示页面不存在，仔细观察 URL，发现和之前的 <code>products/{product}</code> 这个路由冲突了，Laravel
                                在匹配路由的时候会按定义的顺序依次查找，找到第一个匹配的路由就返回。所以当我们访问这个 URL 的时候会先匹配到商品详情页这个路由，然后把
                                <code>favorites</code> 当成商品 ID 去数据库查找，查不到对应的商品就抛出了不存在的异常。</p>
                            <p>解决方案也很简单，把 <code>products/{product}</code> 这个路由放到后面即可：</p>
                            <p><em>routes/web.php</em></p>
                            <p>
                                <a href="https://iocaffcdn.phphub.org/uploads/images/201805/21/5320/cYOOcIJU4A.png?imageView2/2/w/1240/h/0"
                                   class="fluidbox fluidbox__instance-2 fluidbox--initialized fluidbox--closed fluidbox--ready">
                                    <div class="fluidbox__wrap" style="z-index: 990;"><img
                                            src="https://iocaffcdn.phphub.org/uploads/images/201805/21/5320/cYOOcIJU4A.png?imageView2/2/w/1240/h/0"
                                            alt="file" class="fluidbox__thumb" style="opacity: 1;">
                                        <div class="fluidbox__ghost"
                                             style="width: 1100px; height: 455px; top: 11px; left: 1px;"></div>
                                    </div>
                                </a></p>
                            <p>再次刷新页面：</p>
                            <p>
                                <a href="https://iocaffcdn.phphub.org/uploads/images/201806/03/5320/d6931TXmoq.png?imageView2/2/w/1240/h/0"
                                   class="fluidbox fluidbox__instance-3 fluidbox--initialized fluidbox--closed fluidbox--ready">
                                    <div class="fluidbox__wrap" style="z-index: 990;"><img
                                            src="https://iocaffcdn.phphub.org/uploads/images/201806/03/5320/d6931TXmoq.png?imageView2/2/w/1240/h/0"
                                            alt="file" class="fluidbox__thumb" style="opacity: 1;">
                                        <div class="fluidbox__ghost"
                                             style="width: 1100px; height: 698px; top: 11px; left: 1px;"></div>
                                    </div>
                                </a></p>
                            <p>发现样式不对，我们完全可以复用之前商品列表的样式：</p>
                            <p><em>resources/assets/sass/app.scss</em></p>
                            <pre class="  language-php"><code class="  language-php"><span
                                    class="token punctuation">.</span>products<span class="token operator">-</span>index<span
                                    class="token operator">-</span>page<span class="token punctuation">,</span> <span
                                    class="token punctuation">.</span>products<span class="token operator">-</span>favorites<span
                                    class="token operator">-</span>page <span class="token punctuation">{</span>
<span class="token punctuation">.</span>
<span class="token punctuation">.</span>
<span class="token punctuation">.</span>
<span class="token punctuation">}</span></code></pre>
                            <p>再次刷新页面：</p>
                            <p>
                                <a href="https://iocaffcdn.phphub.org/uploads/images/201806/03/5320/cC1zc96Vi7.png?imageView2/2/w/1240/h/0"
                                   class="fluidbox fluidbox__instance-4 fluidbox--initialized fluidbox--closed fluidbox--ready">
                                    <div class="fluidbox__wrap" style="z-index: 990;"><img
                                            src="https://iocaffcdn.phphub.org/uploads/images/201806/03/5320/cC1zc96Vi7.png?imageView2/2/w/1240/h/0"
                                            alt="file" class="fluidbox__thumb" style="opacity: 1;">
                                        <div class="fluidbox__ghost"
                                             style="width: 1100px; height: 698px; top: 11px; left: 1px;"></div>
                                    </div>
                                </a></p>
                            <div name="d0ae84" data-unique="d0ae84"></div>
                            <h2>4. 添加入口</h2>
                            <p>最后我们需要在页面菜单里添加 <code>我的收藏</code> 链接：</p>
                            <p><em>resources/views/layouts/_header.blade.php</em></p>
                            <pre class="  language-php"><code class="  language-php"><span
                                    class="token punctuation">.</span>
<span class="token punctuation">.</span>
<span class="token punctuation">.</span>
<span class="token operator">&lt;</span>ul <span class="token keyword">class</span><span class="token operator">=</span><span
                                        class="token double-quoted-string string">"dropdown-menu"</span> role<span
                                        class="token operator">=</span><span class="token double-quoted-string string">"menu"</span><span
                                        class="token operator">&gt;</span>
  <span class="token punctuation">.</span>
  <span class="token punctuation">.</span>
  <span class="token punctuation">.</span>
  <span class="token operator">&lt;</span>li<span class="token operator">&gt;</span>
    <span class="token operator">&lt;</span>a href<span class="token operator">=</span><span
                                        class="token double-quoted-string string">"{{ route('products.favorites') }}"</span><span
                                        class="token operator">&gt;</span>我的收藏<span
                                        class="token operator">&lt;</span><span class="token operator">/</span>a<span
                                        class="token operator">&gt;</span>
  <span class="token operator">&lt;</span><span class="token operator">/</span>li<span
                                        class="token operator">&gt;</span>
  <span class="token punctuation">.</span>
  <span class="token punctuation">.</span>
  <span class="token punctuation">,</span>
<span class="token operator">&lt;</span><span class="token operator">/</span>ul<span class="token operator">&gt;</span>
<span class="token punctuation">.</span>
<span class="token punctuation">.</span>
<span class="token punctuation">.</span></code></pre>
                            <p>
                                <a href="https://iocaffcdn.phphub.org/uploads/images/201806/03/5320/zK6vYCtBl4.png?imageView2/2/w/1240/h/0"
                                   class="fluidbox fluidbox__instance-5 fluidbox--initialized fluidbox--closed fluidbox--ready">
                                    <div class="fluidbox__wrap" style="z-index: 990;"><img
                                            src="https://iocaffcdn.phphub.org/uploads/images/201806/03/5320/zK6vYCtBl4.png?imageView2/2/w/1240/h/0"
                                            alt="file" class="fluidbox__thumb" style="opacity: 1;">
                                        <div class="fluidbox__ghost"
                                             style="width: 1100px; height: 698px; top: 11px; left: 1px;"></div>
                                    </div>
                                </a></p>
                            <div name="b462ae" data-unique="b462ae"></div>
                            <h2>Git 代码版本控制</h2>
                            <p>接着让我们将这些文件加入到版本控制中：</p>
                            <pre class="  language-php"><code class="  language-php">$ git add <span
                                    class="token operator">-</span><span class="token constant">A</span>
$ git commit <span class="token operator">-</span>m <span
                                        class="token double-quoted-string string">"用户界面 - 收藏商品列表"</span></code></pre>

                            <p></p>
                            <div style="position: absolute!important;height: 1px;width: 1px;overflow: hidden;clip: rect(1px,1px,1px,1px);">
                                本文章首发在 <a href="https://learnku.com/">LearnKu.com</a> 网站上。
                            </div>
                            <div class="tocify-extend-page" data-unique="tocify-extend-page"
                                 style="height: 1190.03px;"></div>
                        </div>

                    </div>


                </div>


                <div class="ui message basic share-wrap">


                </div>


            </div>


        </div>


    </div>


</div>


<!-- Scripts -->
<script src="https://iocaffcdn.phphub.org//build/js/eeee270aba53346df056-vendors.js"></script>
<script src="https://iocaffcdn.phphub.org//build/js/168d368572eb20187101-app.js"></script>
<a id="scrollUp" href="#top" style="position: fixed; z-index: 2147483647; display: none;">Scroll to top</a></body>
</html>
